package net.gitosc.lianqu1990.common.exception;

import net.gitosc.lianqu1990.common.ResponseData;
import net.gitosc.lianqu1990.common.enums.ResponseState;
import net.gitosc.lianqu1990.common.util.ResponseUtil;

/**
 * @author hanchao
 * @date 2017/10/31 8:47
 */
public class BizException extends RuntimeException {
    private ResponseData response;
    public BizException(String message){
        super(message);
        this.response = ResponseUtil.createResponse(ResponseState.FAILED.getCode(),message);
    }

    public BizException(ResponseData response){
        super(response.getMessage());
        this.response = response;
    }

    public ResponseData getResponse() {
        return response;
    }

    public void setResponse(ResponseData response) {
        this.response = response;
    }
}
